ngl: Fix crash with intel driver on Windows when compiling shaders
authorXavier Claessens <xavier.claessens@collabora.com>
Wed, 24 Mar 2021 13:30:02 +0000 (09:30 -0400)
committerXavier Claessens <xavier.claessens@collabora.com>
Thu, 25 Mar 2021 12:20:30 +0000 (08:20 -0400)
Fixes #3783.

gsk/ngl/resources/conic_gradient.glsl
gsk/ngl/resources/linear_gradient.glsl
gsk/ngl/resources/radial_gradient.glsl

index 3a26cf95638998327d82a0a889447716741de5cf..3df33bcb1182ee11fbe2afacbd3ddceb2c7f2bde 100644 (file)
@@ -32,7 +32,10 @@ uniform float u_color_stops[MAX_COLOR_STOPS * 5];
 _NOPERSPECTIVE_ _IN_ vec2 coord;
 
 float get_offset(int index) {
-  return u_color_stops[5 * index];
+  // u_color_stops[5 * index] makes Intel Windows driver crash.
+  // See https://gitlab.gnome.org/GNOME/gtk/-/issues/3783
+  int base = 5 * index;
+  return u_color_stops[base];
 }
 
 vec4 get_color(int index) {
index c4dfb537225236902cafce1cf1d8f8f090c35c9c..153d7afc980b8169d7bdd40099841cdd8b3889df 100644 (file)
@@ -56,7 +56,10 @@ uniform bool u_repeat;
 _NOPERSPECTIVE_ _IN_ vec4 info;
 
 float get_offset(int index) {
-  return u_color_stops[5 * index];
+  // u_color_stops[5 * index] makes Intel Windows driver crash.
+  // See https://gitlab.gnome.org/GNOME/gtk/-/issues/3783
+  int base = 5 * index;
+  return u_color_stops[base];
 }
 
 vec4 get_color(int index) {
index 5990b39a84f0ed59c57f59e94e4a125ef986d0bd..4311fc5d6304205a4176c6248a79aae4341b0cdc 100644 (file)
@@ -35,7 +35,10 @@ uniform float u_color_stops[MAX_COLOR_STOPS * 5];
 _NOPERSPECTIVE_ _IN_ vec2 coord;
 
 float get_offset(int index) {
-  return u_color_stops[5 * index];
+  // u_color_stops[5 * index] makes Intel Windows driver crash.
+  // See https://gitlab.gnome.org/GNOME/gtk/-/issues/3783
+  int base = 5 * index;
+  return u_color_stops[base];
 }
 
 vec4 get_color(int index) {